package com.wskj.controller.login;

import com.wskj.common.core.controller.BaseController;
import com.wskj.common.core.domain.AjaxResult;
import com.wskj.workbench.service.ISysUserExtendService;
import com.wskj.workbench.vo.app.AppUserLoginVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "登录")
@Slf4j
@AllArgsConstructor
@RestController
@RequestMapping("/api/user")
public class ApiUserLoginController extends BaseController {

    private final ISysUserExtendService isysUserExtendService;

    @ApiOperation("登录")
    @PostMapping(value = "/login")
    public AjaxResult<AppUserLoginVo> login(
            @ApiParam(value = "登录账号", required = true) @RequestParam(value = "phoneNumber") String phoneNumber,
            @ApiParam(value = "登录密码", required = true) @RequestParam(value = "password") String password) {
        return isysUserExtendService.login(phoneNumber, password);
    }
}
